unit Podotch;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, dRoot, DB, StdCtrls, Buttons, ExtCtrls, ComCtrls, cxStyles,
  dxSkinsCore, dxSkinBlack, dxSkinBlue, dxSkinCaramel, dxSkinCoffee,
  dxSkinDarkSide, dxSkinGlassOceans, dxSkiniMaginary, dxSkinLilian,
  dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMoneyTwins,
  dxSkinOffice2007Black, dxSkinOffice2007Blue, dxSkinOffice2007Green,
  dxSkinOffice2007Pink, dxSkinOffice2007Silver, dxSkinPumpkin,
  dxSkinSilver, dxSkinStardust, dxSkinSummer2008, dxSkinsDefaultPainters,
  dxSkinValentine, dxSkinXmas2008Blue, dxSkinscxPCPainter, cxCustomData,
  cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, cxDBData,
  cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
  IBCustomDataSet, cxGridLevel, cxClasses, cxControls, cxGridCustomView,
  cxGrid, IBQuery, RpCon, RpConDS, RpRave, RpDefine, RpBase, RpSystem,
  ToolWin;

type
  TfmPodotch = class(TdlgRoot)
    qPodotch: TIBQuery;
    dbgClients: TcxGrid;
    tvPodotch: TcxGridDBTableView;
    dbgClientsLevel1: TcxGridLevel;
    qPodotchRPID: TIntegerField;
    qPodotchCID: TIntegerField;
    qPodotchRPDATE: TDateField;
    qPodotchPPID: TIntegerField;
    qPodotchRPSUMMA: TIBBCDField;
    qPodotchRPUSERENTER: TIBStringField;
    qPodotchRPTIMEENTER: TDateTimeField;
    qPodotchRPUSEREDIT: TIBStringField;
    qPodotchRPTIMEEDIT: TDateTimeField;
    qPodotchFIO: TIBStringField;
    qPodotchFIO2: TIBStringField;
    tvPodotchRPDATE: TcxGridDBColumn;
    tvPodotchRPSUMMA: TcxGridDBColumn;
    tvPodotchFIO: TcxGridDBColumn;
    tvPodotchFIO2: TcxGridDBColumn;
    RvSystem1: TRvSystem;
    RvProject1: TRvProject;
    rvdsPered_podotch: TRvDataSetConnection;
    ToolBar1: TToolBar;
    ToolButton1: TToolButton;
    procedure FormShow(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure ToolButton1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fmPodotch: TfmPodotch;

implementation
uses dbinv, invtypes, invproc;
{$R *.dfm}

procedure TfmPodotch.FormShow(Sender: TObject);
begin
  inherited;
  qPodotch.Open;
end;

procedure TfmPodotch.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  inherited;
  qPodotch.Close;
end;

procedure TfmPodotch.ToolButton1Click(Sender: TObject);
begin
  inherited;
  if qPodotch.IsEmpty then Exit;
  RvProject1.Open;
  RvProject1.SetParam('Summa', FloatTostrF(tvPodotch.DataController.Summary.FooterSummaryValues[0], ffNumber,18,0));
  //RvProject1.SetParam('Summa', FloatToStr(tvPodotch.DataController.Summary.GroupSummaryDisplayValues[0]));
  RvProject1.ExecuteReport('Peredacha_podotch');
  //tvPodotch.DataController.Summary.GroupSummaryDisplayValues[0]
  RvProject1.Close;
  SetCurrentDir(AppPath);
end;

end.
